{{- if eq .Values.postgresql.secretName "" }}
---
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "gitflic.fullname" . }}-db-user
  labels:
    {{- include "gitflic.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if .Release.IsInstall }}
  postgres-user-password: {{ default (randAlphaNum 19 | nospace) .Values.postgresql.postgresPassword | b64enc | quote }}
  {{ else }}
  postgres-user-password: {{ index (lookup "v1" "Secret" .Release.Namespace (print (include "gitflic.fullname" .) "-db-user" )).data "postgres-user-password" }}
  {{ end }}
{{- end }}